package myumbral;

import it.unisa.dia.gas.jpbc.Element;
import it.unisa.dia.gas.jpbc.Field;
import it.unisa.dia.gas.jpbc.Pairing;
import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory;
import org.bouncycastle.crypto.digests.Blake2bDigest;
import org.bouncycastle.crypto.generators.HKDFBytesGenerator;
import org.bouncycastle.crypto.params.HKDFParameters;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.spec.ECParameterSpec;
import ove.crypto.digest.Blake2b;

import java.security.SecureRandom;
import java.security.Security;

public class Setup {
    Pairing pairing ;
    Field G;
    Field Zq;
    Element g,U;

    Setup(){
        this.pairing = PairingFactory.getPairing("resource/a.properties");
        this.G = pairing.getG1();

        this.Zq = pairing.getZr();
        this.g =  G.newRandomElement();
        this.U =  G.newRandomElement();
    }

//    static Element hash2(Element g){
//        Element
//        return null;
//    }

    static byte[] kdf(byte[] data, int key_length, byte[] salt, byte[] info) {

        HKDFParameters params = new HKDFParameters(data, salt, info);
        Blake2b blake2b = Blake2b.Digest.newInstance();

        HKDFBytesGenerator hkdf = new HKDFBytesGenerator(new Blake2bDigest());
        hkdf.init(params);
        byte[] output = new byte[key_length];
        hkdf.generateBytes(output, 0, key_length);
        return output;
    }






}
